import {
  observable,
  extendObservable,
  computed,
  toJS,
  action
} from '../../../libs/mobx.js';

var CurStore = function(title) {
  let me = this;
  extendObservable(this, {
    filePaths: [],
    ossInfoJson: {},
    selectedCategoryId:''
  });

  this.setFilePath = action((filesPath) => {
    let newFilesPath = [];
    if (filesPath instanceof Array) {
      filesPath.forEach((item, index) => {
        newFilesPath.push({
          path: item
        })
      })
      this.filePaths = newFilesPath;
    } else {
      this.filePaths = filesPath;
    }
  })

  this.UpdateFilePath = action((newFilesPath) => {
    this.filePaths = newFilesPath;
  })

  this.setSelectedCategoryId = action((selectedCategoryId) => {
    me.selectedCategoryId = selectedCategoryId;
  })

  this.setFileProcess = action((i, value) => {
    this.filePaths[i].progress = value;
  })
}

export default new CurStore();